package com.cloud.consulconsumer;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * 启动 consul的服务提供者
 * 命令 > consul agent -dev
 * 接着启动 consul-client、consul-consumer
 * 然后访问 http://localhost:2101/consumer
 *
 * 跟踪观察 consul-consumer服务是如何消费 consul-client服务的/dc接口的
 *
 * 有问题 ：空指针异常
 */
@SpringBootApplication()
@EnableDiscoveryClient
public class ConsulConsumerApplication {

	public static void main(String[] args) {
		SpringApplication.run(ConsulConsumerApplication.class, args);
	}

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
